home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / CursorDevices.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  8.7 KB  |  258 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        CursorDevices.h
  3.  
  4.      Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1993-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __CURSORDEVICES__
  18. #define __CURSORDEVICES__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __MIXEDMODE__
  25.     #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. /*
  52.                         * * *  I M P O R T A N T  * * * 
  53.  
  54.             You will need CursorDevicesGlue.o to use CDM from PowerPC
  55.  
  56.  
  57.     In order to use the Cursor Devices Manager (CDM) on PowerPC systems, you must 
  58.     link with the file CursorDevicesGlue.o and InterfaceLib 1.1.3.  This is necessary
  59.     because the original MixedMode transition code for CDM in InterfaceLib in ROM
  60.     was wrong.  The code in CursorDevicesGlue.o will check to see if the ROM has
  61.     been fixed and calls through to it if so.  If it detects that the ROM has not
  62.     been fixed, it uses its own implementation of the CDM MixedMode transition 
  63.     routines. 
  64.     
  65. */
  66.  
  67. typedef short                             ButtonOpcode;
  68. /* ButtonOpcodes */
  69. enum {
  70.     kButtonNoOp                    = 0,                            /* No action for this button */
  71.     kButtonSingleClick            = 1,                            /* Normal mouse button */
  72.     kButtonDoubleClick            = 2,                            /* Click-release-click when pressed */
  73.     kButtonClickLock            = 3                                /* Click on press, release on next press */
  74. };
  75.  
  76. enum {
  77.     kButtonCustom                = 6                                /* Custom behavior, data = CursorDeviceCustomButtonUPP */
  78. };
  79.  
  80. /* Device Classes */
  81. enum {
  82.     kDeviceClassAbsolute        = 0,                            /* a flat-response device */
  83.     kDeviceClassMouse            = 1,                            /* mechanical or optical mouse */
  84.     kDeviceClassTrackball        = 2,                            /* trackball */
  85.     kDeviceClassTrackPad        = 3
  86. };
  87.  
  88. enum {
  89.     kDeviceClass3D                = 6                                /* a 3D pointing device */
  90. };
  91.  
  92. /* Structures used in Cursor Device Manager calls */
  93.  
  94. struct CursorData {
  95.     struct CursorData *                nextCursorData;                /* next in global list */
  96.     Ptr                             displayInfo;                /* unused (reserved for future) */
  97.     Fixed                             whereX;                        /* horizontal position */
  98.     Fixed                             whereY;                        /* vertical position */
  99.     Point                             where;                        /* the pixel position */
  100.     Boolean                         isAbs;                        /* has been stuffed with absolute coords */
  101.     UInt8                             buttonCount;                /* number of buttons currently pressed */
  102.     long                             screenRes;                    /* pixels per inch on the current display */
  103.     short                             privateFields[22];            /* fields use internally by CDM */
  104. };
  105. typedef struct CursorData                CursorData;
  106. typedef CursorData *                    CursorDataPtr;
  107.  
  108. struct CursorDevice {
  109.     struct CursorDevice *            nextCursorDevice;            /* pointer to next record in linked list */
  110.     CursorData *                    whichCursor;                /* pointer to data for target cursor */
  111.     long                             refCon;                        /* application-defined */
  112.     long                             unused;                        /* reserved for future */
  113.     OSType                             devID;                        /* device identifier (from ADB reg 1) */
  114.     Fixed                             resolution;                    /* units/inch (orig. from ADB reg 1) */
  115.     UInt8                             devClass;                    /* device class (from ADB reg 1) */
  116.     UInt8                             cntButtons;                    /* number of buttons (from ADB reg 1) */
  117.     UInt8                             filler1;                    /* reserved for future */
  118.     UInt8                             buttons;                    /* state of all buttons */
  119.     UInt8                             buttonOp[8];                /* action performed per button */
  120.     unsigned long                     buttonTicks[8];                /* ticks when button last went up (for debounce) */
  121.     long                             buttonData[8];                /* data for the button operation */
  122.     unsigned long                     doubleClickTime;            /* device-specific double click speed */
  123.     Fixed                             acceleration;                /* current acceleration */
  124.     short                             privateFields[15];            /* fields used internally to CDM */
  125. };
  126. typedef struct CursorDevice                CursorDevice;
  127. typedef CursorDevice *                    CursorDevicePtr;
  128. /* for use with CursorDeviceButtonOp when opcode = kButtonCustom */
  129. typedef CALLBACK_API( void , CursorDeviceCustomButtonProcPtr )(CursorDevicePtr ourDevice, short button);
  130. /*
  131.     WARNING: CursorDeviceCustomButtonProcPtr uses register based parameters under classic 68k
  132.              and cannot be written in a high-level language without 
  133.              the help of mixed mode or assembly glue.
  134. */
  135. typedef REGISTER_UPP_TYPE(CursorDeviceCustomButtonProcPtr)         CursorDeviceCustomButtonUPP;
  136. #if OPAQUE_UPP_TYPES
  137.     EXTERN_API(CursorDeviceCustomButtonUPP)
  138.     NewCursorDeviceCustomButtonUPP    (CursorDeviceCustomButtonProcPtr userRoutine);
  139.  
  140.     EXTERN_API(void)
  141.     DisposeCursorDeviceCustomButtonUPP    (CursorDeviceCustomButtonUPP userUPP);
  142.  
  143.     EXTERN_API(void)
  144.     InvokeCursorDeviceCustomButtonUPP    (CursorDevicePtr    ourDevice,
  145.                                     short                    button,
  146.                                     CursorDeviceCustomButtonUPP userUPP);
  147.  
  148. #else
  149.     enum { uppCursorDeviceCustomButtonProcInfo = 0x000ED802 };         /* register no_return_value Func(4_bytes:A2, 2_bytes:D3) */
  150.     #define NewCursorDeviceCustomButtonUPP(userRoutine)             (CursorDeviceCustomButtonUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCursorDeviceCustomButtonProcInfo, GetCurrentArchitecture())
  151.     #define DisposeCursorDeviceCustomButtonUPP(userUPP)             DisposeRoutineDescriptor(userUPP)
  152.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  153.     /* InvokeCursorDeviceCustomButtonUPP can't be called from classic 68k without glue code */
  154.     #else
  155.         #define InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppCursorDeviceCustomButtonProcInfo, (ourDevice), (button))
  156.     #endif
  157. #endif
  158. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  159. #define NewCursorDeviceCustomButtonProc(userRoutine)             NewCursorDeviceCustomButtonUPP(userRoutine)
  160. #define CallCursorDeviceCustomButtonProc(userRoutine, ourDevice, button) InvokeCursorDeviceCustomButtonUPP(ourDevice, button, userRoutine)
  161. EXTERN_API( OSErr )
  162. CursorDeviceMove                (CursorDevicePtr         ourDevice,
  163.                                  long                     deltaX,
  164.                                  long                     deltaY)                                TWOWORDINLINE(0x7000, 0xAADB);
  165.  
  166. EXTERN_API( OSErr )
  167. CursorDeviceMoveTo                (CursorDevicePtr         ourDevice,
  168.                                  long                     absX,
  169.                                  long                     absY)                                TWOWORDINLINE(0x7001, 0xAADB);
  170.  
  171. EXTERN_API( OSErr )
  172. CursorDeviceFlush                (CursorDevicePtr         ourDevice)                            TWOWORDINLINE(0x7002, 0xAADB);
  173.  
  174. EXTERN_API( OSErr )
  175. CursorDeviceButtons                (CursorDevicePtr         ourDevice,
  176.                                  short                     buttons)                            TWOWORDINLINE(0x7003, 0xAADB);
  177.  
  178. EXTERN_API( OSErr )
  179. CursorDeviceButtonDown            (CursorDevicePtr         ourDevice)                            TWOWORDINLINE(0x7004, 0xAADB);
  180.  
  181. EXTERN_API( OSErr )
  182. CursorDeviceButtonUp            (CursorDevicePtr         ourDevice)                            TWOWORDINLINE(0x7005, 0xAADB);
  183.  
  184. EXTERN_API( OSErr )
  185. CursorDeviceButtonOp            (CursorDevicePtr         ourDevice,
  186.                                  short                     buttonNumber,
  187.                                  ButtonOpcode             opcode,
  188.                                  long                     data)                                TWOWORDINLINE(0x7006, 0xAADB);
  189.  
  190. EXTERN_API( OSErr )
  191. CursorDeviceSetButtons            (CursorDevicePtr         ourDevice,
  192.                                  short                     numberOfButtons)                    TWOWORDINLINE(0x7007, 0xAADB);
  193.  
  194. EXTERN_API( OSErr )
  195. CursorDeviceSetAcceleration        (CursorDevicePtr         ourDevice,
  196.                                  Fixed                     acceleration)                        TWOWORDINLINE(0x7008, 0xAADB);
  197.  
  198. EXTERN_API( OSErr )
  199. CursorDeviceDoubleTime            (CursorDevicePtr         ourDevice,
  200.                                  long                     durationTicks)                        TWOWORDINLINE(0x7009, 0xAADB);
  201.  
  202. EXTERN_API( OSErr )
  203. CursorDeviceUnitsPerInch        (CursorDevicePtr         ourDevice,
  204.                                  Fixed                     resolution)                            TWOWORDINLINE(0x700A, 0xAADB);
  205.  
  206. EXTERN_API( OSErr )
  207. CursorDeviceNextDevice            (CursorDevicePtr *        ourDevice)                            TWOWORDINLINE(0x700B, 0xAADB);
  208.  
  209. EXTERN_API( OSErr )
  210. CursorDeviceNewDevice            (CursorDevicePtr *        ourDevice)                            TWOWORDINLINE(0x700C, 0xAADB);
  211.  
  212. EXTERN_API( OSErr )
  213. CursorDeviceDisposeDevice        (CursorDevicePtr         ourDevice)                            TWOWORDINLINE(0x700D, 0xAADB);
  214.  
  215.  
  216. /*
  217.                        * * *  W A R N I N G  * * * 
  218.                 
  219.     The routines CrsrDevMoveTo and CrsrDevNextDevice are no longer needed.
  220.     They were added as a work around until the glue code CursorDevicesGlue.o
  221.     was created.  Please use the functions CursorDeviceMoveTo and
  222.     CursorDeviceNextDevice instead.
  223.  
  224. */
  225. #if OLDROUTINENAMES
  226. EXTERN_API( OSErr )
  227. CrsrDevMoveTo                    (CursorDevicePtr         ourDevice,
  228.                                  long                     absX,
  229.                                  long                     absY)                                TWOWORDINLINE(0x7001, 0xAADB);
  230.  
  231. EXTERN_API( OSErr )
  232. CrsrDevNextDevice                (CursorDevicePtr *        ourDevice)                            TWOWORDINLINE(0x700B, 0xAADB);
  233.  
  234. #endif  /* OLDROUTINENAMES */
  235.  
  236.  
  237.  
  238. #if PRAGMA_STRUCT_ALIGN
  239.     #pragma options align=reset
  240. #elif PRAGMA_STRUCT_PACKPUSH
  241.     #pragma pack(pop)
  242. #elif PRAGMA_STRUCT_PACK
  243.     #pragma pack()
  244. #endif
  245.  
  246. #ifdef PRAGMA_IMPORT_OFF
  247. #pragma import off
  248. #elif PRAGMA_IMPORT
  249. #pragma import reset
  250. #endif
  251.  
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255.  
  256. #endif /* __CURSORDEVICES__ */
  257.  
  258.